package com.hualan.mapper.wsj;

import com.hualan.pojo.CategoryCount;
import com.hualan.pojo.wsj.Cptm;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CptmMapper {
    @Select(value = "select * from ceping_timu where del = 0")
    List<Cptm> listAll();

    // 查询所有分类的题目数量
    @Select("SELECT category, COUNT(*) AS count FROM ceping_timu WHERE del = 0 GROUP BY category")
    List<CategoryCount> countByCategory();

//    根据分类查询题目
    @Select("select * from ceping_timu where category = #{category} and del = 0")
    List<Cptm> listByCategory(Integer category);
}
